<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>递归函数 - 计算阶乘</title>
</head>
<body>
	
	<script>
		function sab(a){
			if (a == 1){
				return 1;
			}else{
				return a * sab(a - 1);    //5 * sab(5 -1)  4 * sab(4 -1)  3 * sab(3 -1)  2 * sab(1 -1)  1 
			}
		}
		console.log(sab(6));
		console.log(sab(8));
		console.log(sab(10));
	</script>
</body>
</html>